/**
 * "Visual Paradigm: DO NOT MODIFY THIS FILE!"
 * 
 * This is an automatic generated file. It will be regenerated every time 
 * you generate persistence class.
 * 
 * Modifying its content may cause the program not work, or your work may lost.
 */

/**
 * Licensee: Faculty of informatics, Burapha University 01
 * License Type: Purchased
 */
package cn.imvc.app.entities;

import java.io.Serializable;
import javax.persistence.*;
@Entity
@org.hibernate.annotations.Proxy(lazy=false)
@Table(name="bankcard")
public class Bankcard implements Serializable {
	public Bankcard() {
	}
	
	private int id;
	
	private cn.imvc.app.entities.Member member;
	
	private Byte isDefault = new Byte("0");
	
	private cn.imvc.app.entities.Bank bank;
	
	private String bankCode;
	
	private String branch;
	
	private String cardholder;
	
	private java.util.Set withdrawals = new java.util.HashSet();
	
	/**
	 * 地址ID
	 */
	public void setId(int value) {
		this.id = value;
	}
	
	/**
	 * 地址ID
	 */
	@Column(name="id", nullable=false)	
	@Id	
	@GeneratedValue(generator="CN_IMVC_APP_ENTITIES_BANKCARD_ID_GENERATOR")	
	@org.hibernate.annotations.GenericGenerator(name="CN_IMVC_APP_ENTITIES_BANKCARD_ID_GENERATOR", strategy="identity")	
	public int getId() {
		return id;
	}
	
	@Transient	
	public int getORMID() {
		return getId();
	}
	
	/**
	 * 1默认收货地址
	 */
	public void setIsDefault(byte value) {
		setIsDefault(new Byte(value));
	}
	
	/**
	 * 1默认收货地址
	 */
	public void setIsDefault(Byte value) {
		this.isDefault = value;
	}
	
	/**
	 * 1默认收货地址
	 */
	@Column(name="isDefault", nullable=true)	
	public Byte getIsDefault() {
		return isDefault;
	}
	
	public void setBankCode(String value) {
		this.bankCode = value;
	}
	
	@Column(name="bankCode", nullable=true, length=255)	
	public String getBankCode() {
		return bankCode;
	}
	
	public void setBranch(String value) {
		this.branch = value;
	}
	
	@Column(name="branch", nullable=true, length=255)	
	public String getBranch() {
		return branch;
	}
	
	public void setCardholder(String value) {
		this.cardholder = value;
	}
	
	@Column(name="cardholder", nullable=true, length=255)	
	public String getCardholder() {
		return cardholder;
	}
	
	public void setBank(cn.imvc.app.entities.Bank value) {
		this.bank = value;
	}
	
	@ManyToOne(targetEntity=cn.imvc.app.entities.Bank.class, fetch=FetchType.LAZY)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.LOCK})	
	@JoinColumns({ @JoinColumn(name="bankId", referencedColumnName="id", nullable=false) })	
	@org.hibernate.annotations.LazyToOne(value=org.hibernate.annotations.LazyToOneOption.NO_PROXY)	
	public cn.imvc.app.entities.Bank getBank() {
		return bank;
	}
	
	public void setMember(cn.imvc.app.entities.Member value) {
		this.member = value;
	}
	
	@ManyToOne(targetEntity=cn.imvc.app.entities.Member.class, fetch=FetchType.LAZY)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.LOCK})	
	@JoinColumns({ @JoinColumn(name="memberId", referencedColumnName="id", nullable=false) })	
	@org.hibernate.annotations.LazyToOne(value=org.hibernate.annotations.LazyToOneOption.NO_PROXY)	
	@org.hibernate.annotations.Index(name="member_id")	
	public cn.imvc.app.entities.Member getMember() {
		return member;
	}
	
	public void setWithdrawals(java.util.Set value) {
		this.withdrawals = value;
	}
	
	@OneToMany(mappedBy="bankcard", targetEntity=cn.imvc.app.entities.Withdrawals.class)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.LOCK})	
	@org.hibernate.annotations.LazyCollection(org.hibernate.annotations.LazyCollectionOption.TRUE)	
	public java.util.Set getWithdrawals() {
		return withdrawals;
	}
	
	
	public String toString() {
		return toString(false);
	}
	
	public String toString(boolean idOnly) {
		if (idOnly) {
			return String.valueOf(getId());
		}
		else {
			StringBuffer sb = new StringBuffer();
			sb.append("Bankcard[ ");
			sb.append("Id=").append(getId()).append(" ");
			if (getMember() != null)
				sb.append("Member.Persist_ID=").append(getMember().toString(true)).append(" ");
			else
				sb.append("Member=null ");
			sb.append("IsDefault=").append(getIsDefault()).append(" ");
			if (getBank() != null)
				sb.append("Bank.Persist_ID=").append(getBank().toString(true)).append(" ");
			else
				sb.append("Bank=null ");
			sb.append("BankCode=").append(getBankCode()).append(" ");
			sb.append("Branch=").append(getBranch()).append(" ");
			sb.append("Cardholder=").append(getCardholder()).append(" ");
			sb.append("Withdrawals.size=").append(getWithdrawals().size()).append(" ");
			sb.append("]");
			return sb.toString();
		}
	}
	
}
